/**
 *                            License
 * THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS  
 * CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). 
 * THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.  
 * ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR  
 * COPYRIGHT LAW IS PROHIBITED.
 * 
 * BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND  
 * AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE  
 * MAY BE CONSIDERED TO BE A CONTRACT,
 * THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED 
 * HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
 * 
 */
package lineage.ui.function.window.secretchat;

import lineage.ui.customize.L1CustomizePanel;

/**
 * 密语聊天框显示'角色形象'用的面板.
 * 
 * @version 2014年2月28日下午5:03:33
 * @author jrwz
 */
public final class L1PanelRoleImage extends L1CustomizePanel {
    private static final long serialVersionUID = -7598814530960474916L;

    /**
     * 静态初始化器，由JVM来保证线程安全.
     */
    private static class Holder {
        static L1PanelRoleImage instance = new L1PanelRoleImage();
    }

    /**
     * 取得该类的实例.
     */
    public static L1PanelRoleImage getInstance() {
        return Holder.instance;
    }

    private L1PanelRoleImage() {
        _x = 472;
        _y = 84;
        imgURL = "./image/RoleImage/272.png";
        // setOpaque(false); // 设置为透明

        init(true);
    }

    /**
     * 转换角色形象.
     * 
     * @param type
     *            - 角色职业
     * @param sex
     *            - 角色性别 0:男 1:女
     */
    public void changeRoleImage(String type, int sex) {
        if (sex == 0) {
            switch (type) {
            case "王":
                imgURL = "./image/RoleImage/722.png";
                break;
            case "骑":
                imgURL = "./image/RoleImage/407.png";
                break;
            case "妖":
                imgURL = "./image/RoleImage/274.png";
                break;
            case "法":
                imgURL = "./image/RoleImage/575.png";
                break;
            case "黑":
                imgURL = "./image/RoleImage/125.png";
                break;
            case "龙":
                imgURL = "./image/RoleImage/859.png";
                break;
            case "幻":
                imgURL = "./image/RoleImage/978.png";
                break;
            default:
                imgURL = "./image/RoleImage/272.png";
                break;
            }
        } else {
            switch (type) {
            case "王":
                imgURL = "./image/RoleImage/654.png";
                break;
            case "骑":
                imgURL = "./image/RoleImage/334.png";
                break;
            case "妖":
                imgURL = "./image/RoleImage/202.png";
                break;
            case "法":
                imgURL = "./image/RoleImage/479.png";
                break;
            case "黑":
                imgURL = "./image/RoleImage/37.png";
                break;
            case "龙":
                imgURL = "./image/RoleImage/922.png";
                break;
            case "幻":
                imgURL = "./image/RoleImage/1083.png";
                break;
            default:
                imgURL = "./image/RoleImage/272.png";
                break;
            }
        }
        repaint();
    }
}
